Avoiding “Deaths by PowerPoint”
Data Storytelling and Python to the rescue
Sebastián Flores, PyCon US 2024, May 20th
Rule #1 of Storytelling:
Always raise the stakes!
Never give away the ending!
Data Storytelling
Why Data Storytelling?
Stories are older than all of our technology
Peak-End Rule by sketplanation
. . .
Game of Thrones rating by Kelvin Neo
Data Storytelling:
Using storytelling tricks to create presentations that will be remembered and that create impact
Emotions create actions
How to make millions of people share statistics on social media?
3 Skills
and
2 Tools
Data Storytelling
Skill: Public Speaking
Public Speaking is
SCARY
Control the attention without being manipulative?
Data Storytelling
Skill: Storytelling
Easy to judge, hard to prepare
Stories are simple
. . .
start, conflict, ending.
Data Storytelling
Tool: Visualization
Too many options!
User cannot be in charge of finding the insights.
So many good python libraries!
Pick one and master it
Don’t focus on the numbers. Focus on the story.
(C) Storytelling with Data, por Cole Nussbaumer Knaflic.
A Data Storytelling library in JS & Python
#| code-fold: true
#| code-summary: "Show the code"
import pandas as pd
from ipyvizzu import Data, Config, Style
from ipyvizzustory import Story, Slide, Step
# Create data object, read csv to data frame and add data frame to data object
data = Data()
df = pd.read_csv(
"./data/population.csv",
dtype={"Year": str},
)
data.add_df(df)
# Create story object, add data to it
story = Story(data=data)
# Set the size of the HTML element
# that appears within the notebook
story.set_size("100%", "400px")
# Switch on the tooltip that appears
# when the user hovers the mouse over a chart element
story.set_feature("tooltip", True)
# Each slide here is a page in the final interactive story
# Add the first slide
slide1 = Slide(
Step(
Data.filter("record.Continent == 'Africa'"),
Config.stackedArea(
{
"x": "Year",
"y": "Medium",
"stackedBy": "Subregion",
"title": "Population of Africa 1953-2098",
}
),
Style({"plot": {"xAxis": {"label": {"angle": 2.0}}}}),
)
)
# Add the slide to the story
story.add_slide(slide1)
slide2 = Slide(
Step(
Config.percentageArea(
{
"x": "Year",
"y": "Medium",
"stackedBy": "Subregion",
}
),
)
)
story.add_slide(slide2)
slide3 = Slide(
Step(
Config.stream(
{
"x": "Year",
"y": "Medium",
"stackedBy": "Subregion",
}
),
)
)
story.add_slide(slide3)
slide4 = Slide(
Step(
Config.violin(
{
"x": "Year",
"y": "Medium",
"splittedBy": "Subregion",
}
),
)
)
story.add_slide(slide4)
# Play the created story!
story.play()Data Storytelling
Tool: Presentation
Sistema de publicación científica y técnica, construida en Pandoc.
Foco en markdown científico, código, reproducibilidad e interacción.
Code
---
title: "Habits"
author: "John Doe"
format:
revealjs:
transition: fade
theme: black
toc: true
center: true
---
## Getting up
- Turn off alarm
- Get out of bed
---
## Going to sleep
::: { .incremental }
- Get in bed
- Count sheep
:::
Slides
Quarto
Pros
Cons
Jupyter + RISE
Evaluación de código “en vivo”